<!-- 使用栗子 -->
 
<!-- 
增加一个透明的actionButton，以使title居中显示
<action-bar title='更多比赛' :style='{backgroundColor: "#e54f20"}'>
  <template slot='left'>
    <action-button @click='onBack' color='#fff'>
      <i class="iconfont icon-fanhui"></i>
    </action-button>
  </template>
  <template slot='right'>
    <action-button color='transparent'></action-button>
  </template>
</action-bar>  
-->

<template>
  <div :class="$style.header">
    <slot name='left'></slot>
    <div :class="$style.title" :style='{color: color}'>{{ title }}</div>
    <slot name='right'></slot>
  </div>
</template>

<script>
  export default {
    props: {
      title: {
        type: String,
        default: ''
      },
      color: {
        type: String,
        default: '#fff'
      }
    },
    methods: {
      back () {
        history.go(-1)
      }
    }
  }
</script>

<style lang="less" module>
  .header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 44px;
    display: flex;
    z-index: 1039;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 8px;
  }

  .title {
    flex: 1;
    text-align: center;
    color: #FFF;
    font-size: 17px;
    height: 44px;
    line-height: 44px;
    overflow: hidden;
    text-overflow:ellipsis;
    white-space: nowrap;
  }
</style>